import { NextResponse } from "next/server"

/**
 * 获取搜索提示词
 *
 * @route GET /api/search/suggestions
 * @param {string} keyword - 用户输入的关键词
 * @param {number} limit - 返回结果数量限制，默认为10
 *
 * @returns {Object} 返回搜索提示词列表
 *
 * 请求示例:
 * GET /api/search/suggestions?keyword=周杰&limit=5
 *
 * 返回示例:
 * {
 *   "success": true,
 *   "data": [
 *     { "id": "1", "type": "artist", "name": "周杰伦" },
 *     { "id": "2", "type": "song", "name": "周杰伦 - 晴天" },
 *     { "id": "3", "type": "album", "name": "周杰伦 - 叶惠美" },
 *     { "id": "4", "type": "playlist", "name": "周杰伦热门歌曲集" },
 *     { "id": "5", "type": "lyric", "name": "周杰伦 - 简单爱: 我想就这样牵着你的手不放开" }
 *   ]
 * }
 */
export async function GET(request: Request) {
  const { searchParams } = new URL(request.url)
  const keyword = searchParams.get("keyword")
  const limit = Number(searchParams.get("limit") || "10")

  // 实现搜索提示词逻辑
  return NextResponse.json({
    success: true,
    data: [
      { id: "1", type: "artist", name: "周杰伦" },
      { id: "2", type: "song", name: "周杰伦 - 晴天" },
      { id: "3", type: "album", name: "周杰伦 - 叶惠美" },
      { id: "4", type: "playlist", name: "周杰伦热门歌曲集" },
      { id: "5", type: "lyric", name: "周杰伦 - 简单爱: 我想就这样牵着你的手不放开" },
    ].slice(0, limit),
  })
}

